
# 测试插入数据
import os
import random


def main():
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', '老男孩CRM.settings')
    import django
    django.setup()
    from sales import models
    source_type = (('qq', "qq群"),
                   ('referral', "内部转介绍"),
                   ('website', "官方网站"),
                   ('baidu_ads', "百度推广"),
                   ('office_direct', "直接上门"),
                   ('WoM', "口碑"),
                   ('public_class', "公开课"),
                   ('website_luffy', "路飞官网"),
                   ('others', "其它"),)
    course_choices = (('LinuxL', 'Linux中高级'),
                      ('PythonFullStack', 'Python高级全栈开发'),)
    obj_list = []
    for i in range(251):
        dic = {
            'qq': str(11111 + i),
            'name': f'AK{i}号',
            'source': random.choice(source_type)[0],
            'course': random.choice(course_choices)[0],
        }
        obj = models.Customer(**dic)
        obj_list.append(obj)
    models.Customer.objects.bulk_create(obj_list)


if __name__ == '__main__':
    main()
